
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author robit
 */
public class MapLearn {

    public static void main(String [] args){
        Map<String,B> m = new HashMap<String,B>();
        B b= new B(2);B bb= new B(2);
        m.put("xyz", b);
        m.put("abc", b);
        System.out.println(m);
        m.values().removeAll(Collections.singleton(bb));
        System.out.println(m);
        Map<String,Integer> c = new HashMap<String,Integer>();
        c.put("xyz",1);
    }
    static class B{
        int b;
        B(int b){
            this.b=b;
        }

        @Override
        public boolean equals(Object obj) {
            if(!(obj instanceof B))return false;

            return ((B)obj).b==this.b;
        }

    }

}
